<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>YUI ClassNameManager Tests</title>
    <script src="../../../build/yui/yui.js" type="text/javascript"></script>
    <style type="text/css">
        #console .yui3-console-entry {
            padding:2px;
            margin:0px;
            min-height:0;
        }

        #console .yui3-console-entry-fail .yui3-console-entry-cat {
            background-color:red;
        }

        #console .yui3-console-entry-pass .yui3-console-entry-cat {
            background-color:green;
        }

        #console .yui3-console-entry-perf .yui3-console-entry-cat {
            background-color:blue;
        }

        #console {
            position:static;
        }

        html, body {
            height:100%;
        }
    </style>
    
</head>
<body class="yui3-skin-sam">
<script type="text/javascript">
	YUI({useBrowserConsole:false}).use("test", "classnamemanager", "console", function(Y) {

	    var testClassNameManager = new Y.Test.Case({

            name: "ClassNameManager Tests",

            testSingleSection: function() {
				Y.Assert.areEqual(Y.ClassNameManager.getClassName("menuitem"), "yui3-menuitem");
            },
            
            testSingleSectionNoPrefix: function() {
                Y.Assert.areEqual(Y.ClassNameManager.getClassName("menuitem", true), "menuitem");
            },
            
            testMoreThanOneSection : function() {
				Y.Assert.areEqual(Y.ClassNameManager.getClassName("menuitem", "active"), "yui3-menuitem-active");
            },

            testMoreThanOneSectionNoPrefix : function() {
                Y.Assert.areEqual(Y.ClassNameManager.getClassName("menuitem", "active", true), "menuitem-active");
            }
        });

        var suite = new Y.Test.Suite("ClassNameManager Tests");
        suite.add(new Y.Test.Case(testClassNameManager));

        Y.Test.Runner.setName("ClassNameManager Tests");
        Y.Test.Runner.add(suite);
        Y.Test.Runner.disableLogging();
        Y.Test.Runner.run();
        
        var console;
        
        Y.one("#btnRun").set("disabled", false).on("click", function() {
            if (!console) {
                console = new Y.Console({
                    id:"console",
                    width:"100%",
                    height:"90%",
                    verbose : false,
                    printTimeout: 0,
                    newestOnTop : false,
                    entryTemplate: '<pre class="{entry_class} {cat_class} {src_class}">'+
                            '<span class="{entry_cat_class}">{label}</span>'+
                            '<span class="{entry_content_class}">{message}</span>'+
                    '</pre>'
                }).render();
            }
    
            Y.Test.Runner.enableLogging();
            Y.Test.Runner.run();
        });
	});
</script>
<p><input type="button" value="Run Tests" id="btnRun" disabled=true></p>
</body>
</html>
